package com.wyy.test.sede;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @Date: 2023/10/9
 * @Author: wyy
 */
public enum LraStatusEnum {
    /**
     * 申请中
     */
    APPLYING("applying", 0),
    /**
     * 已取消
     */
    CANCELED("canceled", 1),
    /**
     * 已同意
     */
    APPROVED("approved", 2),
    /**
     * 已拒绝
     */
    REJECTED("rejected", 3),
    /**
     * 超时
     */
    TIME_OUT("timeout", 4),
    /**
     * 自动同意
     */
    AUTO_APPROVED("autoApproved", 5),

    ;

    @JsonValue
    private String desc;

    private int value;

    private static LraStatusEnum[] values;

    static {
        values = values();
    }

    LraStatusEnum(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }


    public boolean isApplying() {
        return this == APPLYING;
    }

    public static LraStatusEnum getStatusByDesc(String desc) {
        for (LraStatusEnum st : values) {
            if (st.getDesc().equals(desc)) {
                return st;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return desc;
    }

    public String getDesc() {
        return desc;
    }

    public int getValue() {
        return value;
    }
}


